/*
 * SCSI.H Version 1.01 (C)1995,1996 HUDSON SOFT
 * SCSI(CR-ROM)関連 Ｃコンパイラ用ヘッダーファイル(SCSI.H)
 */

#ifndef _SCSI_H_
#define _SCSI_H_

#ifndef NULL
#define NULL ((void *)0)
#endif

#include <scsi_cmd.h>

/*--- scsi() ----*/
/*
 *  struct of SCSI command
 */

struct scsi_cmd {
    unsigned int istat;		/* initiator status */
    unsigned int tstat;		/* target status */
    unsigned int unit;		/* target unit no */
    unsigned int mess;		/* message */
    unsigned char *data;	/* address of data buffer */
    unsigned int count;		/* data count */
    unsigned int block;		/* block size */
    unsigned int mode;		/* read mode */
    unsigned char *cmd;		/* command data block */
};
typedef struct scsi_cmd SCSI;

struct read28_prm {
    int stat;			/* function status */
    unsigned int id_bit;	/* target unit id bit */
    long block;			/* top block */
    long blklen;		/* block length */
    int scsi_stat;		/* scsi status phase value */
};
typedef struct read28_prm READ28;

/*
 *  initiator status
 */
#define INIT_OK 0x80		/* good */
#define INIT_TO 0x40		/* time out */
#define INIT_DL 0x20		/* bad data length */
#define INIT_BUSY 0x10		/* scsi controller busy */
#define INIT_DMA 0x08		/* DMA aborted */
/*
 *  target status
 */
#define	TRGT_BUSY	0x8
#define	TRGT_CM		0x4
#define	TRGT_CC		0x2
#define	TRGT_GOOD	0x0

/*
 * read mode
 */
#define READ_MRAM 0
#define READ_KRAM 1
#define READ_KRAM_DMA 3

/*
 * read28 stat
 */
#define READ28_END 0
#define READ28_IDLE 1
#define READ28_READ 2
#define READ28_BUSY 3
#define READ28_NOT_CONNECT 4
#define READ28_BREAK 5
#define READ28_ABORT 6
/*
 * scsi_dma_int return value
 */
#define DMA_SCSI 0
#define DMA_READ28 1
#define DMA_OTHER (-1)

/*
 * scsi_block_int return value
 */
#define PMM_DMA_SCSI 0
#define PMM_DMA_READ28 1
#define PMM_OTHER (-1)

/*
 *  scsi commands
 */
int scsi(SCSI * );
void init_scsi(void);
void bzero(void * ,int );
void reset_scsi(void);
int open_read28(READ28 * );
int close_read28(void );
int read28(unsigned long ,int );
int scsi_dma_int(void );
int scsi_block_int(void );

#endif	/* _SCSI_H_ */
